<template>
	<page-body>
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex bindWechat_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub bindWechat_fd0_0'>
					<view class='flex align-center bindWechat_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  bindWechat_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex align-center'>
						<text class='bindWechat_fd0_0_c1_c0'>绑定微信</text>
					</view>
					<view class='flex align-center bindWechat_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---绑定支付宝flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout bindWechat_flex_1">
				<view class='flex flex-direction align-stretch bindWechat_fd1_0'>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c0'>
						<text class='bindWechat_fd1_0_c0_c0'>第一步：先获取手机验证码</text>
					</view>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c1'>
						<text class='bindWechat_fd1_0_c1_c0'>绑定的用户手机</text>
						<text class='bindWechat_fd1_0_c1_c0'>{{dataMessage.mobile}}</text>
					</view>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c2'>
						<text class='bindWechat_fd1_0_c2_c0'>验证码</text>
						<benben-input class='flex-sub bindWechat_fd1_0_c2_c1' type="number" :placeholder="`请输入验证码`"
							confirm-type="done" :maxlength="4" placeholder-style="color:#BFBFBF;font-size:28rpx"
							v-model="code" />
						<benben-send-verification-code key='1689818850301' ref="vCode1689818850301"
							class=' bindWechat_fd1_0_c2_c2' after-text='后重新获取' before-text='获取验证码' type='3'
							:phone="dataMessage._mobile"></benben-send-verification-code>
					</view>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c3'>
						<text class='bindWechat_fd1_0_c0_c0'>第二步：上传微信收款二维码</text>
					</view>
					<view class='flex flex-direction flex-wrap align-start bindWechat_fd1_0_c4'>
						<view class='flex flex-wrap align-center'>
							<benben-image-upload :path.sync="databangding.qrcode_url"
								:img-id.sync="databangding.qrcode_url" :is-cropping="false" :is-show-clean="false"
								class="upload position-relative bindWechat_fd1_0_c4_c0_c0">
								<!-- <text v-if="databangding.qrcode_url != ''" data-type="clean"
									class='fu-iconfont2 position-absolute bindWechat_fd1_0_c4_c0_c0_icon'>&#xE8E7;</text> -->
								<image class=" bindWechat_fd1_0_c4_c0_c0" mode="aspectFill"
									:src="databangding.qrcode_url ? databangding.qrcode_url : STATIC_URL+'149.png'">
								</image>
							</benben-image-upload>
						</view>
						<text class='bindWechat_fd1_0_c4_c1'>上传二维码</text>
					</view>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c1'>
						<text class='bindWechat_fd1_0_c0_c0'>第三步：填写微信真实姓名</text>
					</view>
					<view class='flex flex-wrap align-center bindWechat_fd1_0_c6'>
						<text class='bindWechat_fd1_0_c6_c0'>真实姓名</text>
						<benben-input class='flex-sub bindWechat_fd1_0_c2_c1' type="text" :placeholder="`请输入真实姓名`"
							confirm-type="done" :maxlength="-1" placeholder-style="color:#BFBFBF;font-size:28rpx"
							v-model="databangding.real_name" />
					</view>
				</view>
				<view class='flex flex-wrap align-center justify-center bindWechat_fd1_1'>
					<button class='bindWechat_fd1_1_c0' @tap.stop="queryListFunc()">提交</button>
				</view>
			</view>

			<!---绑定支付宝flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"dataMessage": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"nickname": "",
					"is_pay_password": "",
					"follow_count": ""
				},
				"databangding": {
					"aid": "",
					"is_default": "",
					"create_time": "",
					"update_time": "",
					"status": "",
					"real_name": "",
					"account": "",
					"qrcode_url": "",
					"bank_name": "",
					"bank_address": "",
					"remark": ""
				},
				"code": "",
				"type": "",
				posTtype:false,
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			let {
				type
			} = options
			if (type !== undefined) this.type = type
			this.getUserinfoFunc()
			this.getbangdingtsFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取会员详细信息
			async getUserinfoFunc() {
				//请求方法
				//数据验证

				let datadataMessage = await this.$api.get(global.apiUrls.post5c78c4772da97, {

				});

				if (datadataMessage.data.code != 1) {
					this.$message.info(datadataMessage.data.msg);
					return
				}
				let infodataMessage = datadataMessage.data;
				this.dataMessage = infodataMessage.data

			},
			//获取绑定信息
			async getbangdingtsFunc() {
				if (this.type == '1') {
					//请求方法
					//数据验证

					let datadatabangding = await this.$api.get(global.apiUrls.post64793f5df043e, {
						account_type: '1'
					});

					if (datadatabangding.data.code != 1) {
						this.$message.info(datadatabangding.data.msg);
						return
					}
					let infodatabangding = datadatabangding.data;
					this.databangding = infodatabangding.data

				}
			},
			//钱包-设置提现账户
			async queryListFunc() {
				// console.log(this.databangding.real_name,123)
				if (!validate(this.code, 'require')) {
					this.$message.info('请输入验证码');
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info('请输入正确的验证码');
					return false;
				}
				if (!validate(this.databangding.qrcode_url, 'require')) {
					this.$message.info('请上传二维码');
					return false;
				}
				if (!validate(this.databangding.real_name, 'require')) {
					this.$message.info('请输入真实姓名');
					return false;
				}
				//请求方法
				//数据验证

				// let data5f6db4db8abcf = await this.$api.post(global.apiUrls.post5f6db4db8abcf, {
				// 	mobile: this.dataMessage._mobile,
				// 	code: this.code,
				// 	type: '3'
				// });

				// if (data5f6db4db8abcf.data.code != 1) {
				// 	this.$message.info(data5f6db4db8abcf.data.msg);
				// 	return
				// }
				// let info5f6db4db8abcf = data5f6db4db8abcf.data;


				//请求方法
				//数据验证
				let page = {
					real_name: this.databangding.real_name,
					account_type: '1',
					qrcode_url: this.databangding.qrcode_url,
					code:this.code,
					tel:this.dataMessage._mobile,
				}
				if(this.posTtype){
					return
				}
				this.posTtype = true
				let data636cc0cc8d6cc = await this.$api.post(global.apiUrls.post64793e01427b6, page);

				if (data636cc0cc8d6cc.data.code != 1) {
					this.$message.info(data636cc0cc8d6cc.data.msg);
					this.posTtype = false
					return
				}
				let info636cc0cc8d6cc = data636cc0cc8d6cc.data;


				this.$message.info('微信绑定成功');
				setTimeout(() => {
					this.$urouter.navigateBack(1);
				}, 500)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.bindWechat_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.bindWechat_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.bindWechat_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.bindWechat_fd0_0_c0 {
		width: 180rpx;
	}

	.bindWechat_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.bindWechat_flex_1 {
		padding: 0rpx 0rpx 150rpx 0rpx;
	}

	.bindWechat_fd1_1_c0 {
		background: #FF8E21;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-weight: 700;
	}

	.bindWechat_fd1_1 {
		width: 750rpx;
		position: fixed;
		left: 0rpx;
		bottom: calc(40rpx + var(--window-bottom));
	}

	.bindWechat_fd1_0_c6_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		margin: 0rpx 32rpx 0rpx 0rpx;
	}

	.bindWechat_fd1_0_c6 {
		padding: 0rpx 0rpx 32rpx 0rpx;
		line-height: 48rpx;
	}

	.bindWechat_fd1_0_c4_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.bindWechat_fd1_0_c4_c0_c0_icon {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.bindWechat_fd1_0_c4_c0_c0 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.bindWechat_fd1_0_c4 {
		border-bottom: 1px solid #eee;
		padding: 0rpx 0rpx 32rpx 0rpx;
		margin: 0rpx 0rpx 40rpx 0rpx;
	}

	.bindWechat_fd1_0_c3 {
		margin: 40rpx 0rpx 32rpx 0rpx;
	}

	.bindWechat_fd1_0_c2_c2 {
		text-align: center;
		font-size: 28rpx;
		color: rgba(22, 158, 240, 1);
		font-weight: 400;
	}

	.bindWechat_fd1_0_c2_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}

	.bindWechat_fd1_0_c2_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		margin: 0rpx 24rpx 0rpx 0rpx;
	}

	.bindWechat_fd1_0_c2 {
		border-bottom: 1px solid #eee;
		padding: 0rpx 0rpx 32rpx 0rpx;
	}

	.bindWechat_fd1_0_c1_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
	}

	.bindWechat_fd1_0_c1 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.bindWechat_fd1_0_c0_c0 {
		font-size: 28rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
	}

	.bindWechat_fd1_0_c0 {
		padding: 40rpx 0rpx 32rpx 0rpx;
	}

	.bindWechat_fd1_0 {
		background: var(--benbenbgColor1);
		padding: 0rpx 32rpx 0rpx 32rpx;
		background-size: 100% auto !important;
	}
</style>
